package cc.lj.internal.coupons.interfaces.facade;

import cc.lj.internal.api.coupons.dto.CouponsSettlementApiDTO;
import cc.lj.internal.api.coupons.dto.command.CouponsSettlementApiCommand;
import cc.lj.internal.core.exception.SysExceptionEnum;
import cc.lj.internal.core.http.HttpResult;
import cc.lj.internal.coupons.application.service.CouponsSettlementAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 电子券分摊结算相关数据对外api
 * @author liangxifeng
 * @date 2022-01-15
 */
@RestController
@Slf4j
@Validated
@Api(tags = "电子券分摊结算相关数据对外api")
@RequestMapping("coupons")
public class CouponsSettlementController {
    @Resource(name = "couponsSettlementAppService")
    private CouponsSettlementAppService settlementAppService;
    /**
     * 电子券分摊结算数据查询
     * @param couponsSettlementApiCommand 电子券分摊结算入参command
     * @return
     */
    @PostMapping("/getSettlementData")
    @ApiOperation(value = "电子券分摊结算数据查询",notes = "错误码：1005001019,1005001006")
    HttpResult<CouponsSettlementApiDTO> getSettlementData(@Valid @RequestBody CouponsSettlementApiCommand couponsSettlementApiCommand)
    {
        CouponsSettlementApiDTO settlementApiDTO = settlementAppService.getShareData(couponsSettlementApiCommand);
        return HttpResult.success(SysExceptionEnum.SUCCESS.getCode(),SysExceptionEnum.SUCCESS.getMessage(),settlementApiDTO);
    }
}
